mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 11:39:02 -04:00
Added oper classes and types (done through the planned privilage system on a per-command basis)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@756 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
2977a23070
commit
9f40c69ca0
@ -1,5 +1,5 @@
|
||||
[Editors]
|
||||
Focused=-1
|
||||
Focused=6
|
||||
Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0,49
|
||||
|
||||
[Editor_0]
|
||||
@ -13,9 +13,9 @@ LeftChar=1
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=26
|
||||
CursorRow=90
|
||||
TopLine=131
|
||||
CursorCol=2
|
||||
CursorRow=211
|
||||
TopLine=180
|
||||
LeftChar=1
|
||||
|
||||
[Editor_2]
|
||||
@ -52,10 +52,10 @@ LeftChar=1
|
||||
|
||||
[Editor_6]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=16
|
||||
CursorRow=17
|
||||
TopLine=38
|
||||
Top=1
|
||||
CursorCol=24
|
||||
CursorRow=140
|
||||
TopLine=94
|
||||
LeftChar=1
|
||||
|
||||
[Editor_7]
|
||||
@ -181,14 +181,14 @@ LeftChar=1
|
||||
[Editor_22]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=34
|
||||
CursorRow=78
|
||||
TopLine=51
|
||||
CursorCol=1
|
||||
CursorRow=182
|
||||
TopLine=92
|
||||
LeftChar=1
|
||||
|
||||
[Editor_23]
|
||||
Open=1
|
||||
Top=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=69
|
||||
TopLine=14
|
||||
@ -330,9 +330,9 @@ LeftChar=1
|
||||
[Editor_43]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=34
|
||||
CursorRow=1536
|
||||
TopLine=1498
|
||||
CursorCol=1
|
||||
CursorRow=86
|
||||
TopLine=49
|
||||
LeftChar=1
|
||||
[Editor_44]
|
||||
Open=1
|
||||
|
@ -1337,6 +1337,7 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
|
||||
/* found this oper's opertype */
|
||||
ConfValue("type","host",j,Hostname,&config_f);
|
||||
ChangeDisplayedHost(user,Hostname);
|
||||
strncpy(user->oper,TypeName,NICKMAX);
|
||||
}
|
||||
}
|
||||
if (!strchr(user->modes,'o'))
|
||||
|
@ -2739,6 +2739,13 @@ void process_command(userrec *user, char* cmd)
|
||||
cmd_found = 1;
|
||||
return;
|
||||
}
|
||||
if ((cmdlist[i].flags_needed) && (!user->HasPermission(command)))
|
||||
{
|
||||
log(DEBUG,"process_command: permission denied: %s %s",user->nick,command);
|
||||
WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command);
|
||||
cmd_found = 1;
|
||||
return;
|
||||
}
|
||||
/* if the command isnt USER, PASS, or NICK, and nick is empty,
|
||||
* deny command! */
|
||||
if ((strncmp(command,"USER",4)) && (strncmp(command,"NICK",4)) && (strncmp(command,"PASS",4)))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
|
||||
Manages userrec objects
|
||||
*/
|
||||
|
||||
#include "inspircd_config.h"
|
||||
@ -8,6 +8,8 @@
|
||||
#include "inspircd.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern std::stringstream config_f;
|
||||
|
||||
userrec::userrec()
|
||||
{
|
||||
// the PROPER way to do it, AVOID bzero at *ALL* costs
|
||||
@ -91,3 +93,61 @@ void userrec::RemoveInvite(char* channel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool userrec::HasPermission(char* command)
|
||||
{
|
||||
char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF];
|
||||
char* myclass;
|
||||
char* mycmd;
|
||||
char* savept;
|
||||
char* savept2;
|
||||
|
||||
// are they even an oper at all?
|
||||
if (strchr(this->modes,'o'))
|
||||
{
|
||||
log(DEBUG,"*** HasPermission: %s is an oper",this->nick);
|
||||
for (int j =0; j < ConfValueEnum("type",&config_f); j++)
|
||||
{
|
||||
ConfValue("type","name",j,TypeName,&config_f);
|
||||
if (!strcmp(TypeName,this->oper))
|
||||
{
|
||||
log(DEBUG,"*** HasPermission: %s is an oper of type '%s'",this->nick,this->oper);
|
||||
ConfValue("type","classes",j,Classes,&config_f);
|
||||
char* myclass = strtok_r(Classes," ",&savept);
|
||||
//myclass = savept;
|
||||
while (myclass)
|
||||
{
|
||||
log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass);
|
||||
for (int k =0; k < ConfValueEnum("class",&config_f); k++)
|
||||
{
|
||||
ConfValue("class","name",k,ClassName,&config_f);
|
||||
if (!strcmp(ClassName,myclass))
|
||||
{
|
||||
ConfValue("class","commands",k,CommandList,&config_f);
|
||||
log(DEBUG,"*** HasPermission: found class named %s with commands: '%s'",ClassName,CommandList);
|
||||
|
||||
|
||||
mycmd = strtok_r(CommandList," ",&savept2);
|
||||
//mycmd = savept2;
|
||||
while (mycmd)
|
||||
{
|
||||
if (!strcasecmp(mycmd,command))
|
||||
{
|
||||
log(DEBUG,"*** Command %s found, returning true",command);
|
||||
return true;
|
||||
}
|
||||
mycmd = strtok_r(NULL," ",&savept2);
|
||||
//mycmd = savept2;
|
||||
}
|
||||
}
|
||||
}
|
||||
myclass = strtok_r(NULL," ",&savept);
|
||||
//myclass = savept;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
#!sh
|
||||
echo "InspIRCd-1.0[Alpha11]"
|
||||
echo "InspIRCd-1.0[Alpha12]"
|
||||
|
Loading…
x
Reference in New Issue
Block a user