@@ 3023-3069 (lines=47) @@ | ||
3020 | * @param array $permissions permissions |
|
3021 | * @return boolean success |
|
3022 | */ |
|
3023 | function serverGroupAddPerm($sgid, $permissions) { |
|
3024 | if(!$this->runtime['selected']) { return $this->checkSelected(); } |
|
3025 | ||
3026 | if(count($permissions) > 0) { |
|
3027 | //Permissions given |
|
3028 | ||
3029 | //Errorcollector |
|
3030 | $errors = array(); |
|
3031 | ||
3032 | //Split Permissions to prevent query from overload |
|
3033 | $permissions = array_chunk($permissions, 50, true); |
|
3034 | ||
3035 | //Action for each splitted part of permission |
|
3036 | foreach($permissions as $permission_part) |
|
3037 | { |
|
3038 | //Create command_string for each command that we could use implode later |
|
3039 | $command_string = array(); |
|
3040 | ||
3041 | foreach($permission_part as $key => $value) |
|
3042 | { |
|
3043 | $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2]; |
|
3044 | } |
|
3045 | ||
3046 | $result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $command_string)); |
|
3047 | ||
3048 | if(!$result['success']) |
|
3049 | { |
|
3050 | foreach($result['errors'] as $error) |
|
3051 | { |
|
3052 | $errors[] = $error; |
|
3053 | } |
|
3054 | } |
|
3055 | } |
|
3056 | ||
3057 | if(count($errors) == 0) |
|
3058 | { |
|
3059 | return $this->generateOutput(true, array(), true); |
|
3060 | }else{ |
|
3061 | return $this->generateOutput(false, $errors, false); |
|
3062 | } |
|
3063 | ||
3064 | }else{ |
|
3065 | // No permissions given |
|
3066 | $this->addDebugLog('no permissions given'); |
|
3067 | return $this->generateOutput(false, array('Error: no permissions given'), false); |
|
3068 | } |
|
3069 | } |
|
3070 | ||
3071 | /** |
|
3072 | * serverGroupAutoAddPerm |
|
@@ 3089-3135 (lines=47) @@ | ||
3086 | * @param array $permissions permissions |
|
3087 | * @return boolean success |
|
3088 | */ |
|
3089 | function serverGroupAutoAddPerm($sgtype, $permissions) { |
|
3090 | if(!$this->runtime['selected']) { return $this->checkSelected(); } |
|
3091 | ||
3092 | if(count($permissions) > 0) { |
|
3093 | //Permissions given |
|
3094 | ||
3095 | //Errorcollector |
|
3096 | $errors = array(); |
|
3097 | ||
3098 | //Split Permissions to prevent query from overload |
|
3099 | $permissions = array_chunk($permissions, 50, true); |
|
3100 | ||
3101 | //Action for each splitted part of permission |
|
3102 | foreach($permissions as $permission_part) |
|
3103 | { |
|
3104 | //Create command_string for each command that we could use implode later |
|
3105 | $command_string = array(); |
|
3106 | ||
3107 | foreach($permission_part as $key => $value) |
|
3108 | { |
|
3109 | $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2]; |
|
3110 | } |
|
3111 | ||
3112 | $result = $this->getData('boolean', 'servergroupautoaddperm sgtype='.$sgtype.' '.implode('|', $command_string)); |
|
3113 | ||
3114 | if(!$result['success']) |
|
3115 | { |
|
3116 | foreach($result['errors'] as $error) |
|
3117 | { |
|
3118 | $errors[] = $error; |
|
3119 | } |
|
3120 | } |
|
3121 | } |
|
3122 | ||
3123 | if(count($errors) == 0) |
|
3124 | { |
|
3125 | return $this->generateOutput(true, array(), true); |
|
3126 | }else{ |
|
3127 | return $this->generateOutput(false, $errors, false); |
|
3128 | } |
|
3129 | ||
3130 | }else{ |
|
3131 | // No permissions given |
|
3132 | $this->addDebugLog('no permissions given'); |
|
3133 | return $this->generateOutput(false, array('Error: no permissions given'), false); |
|
3134 | } |
|
3135 | } |
|
3136 | ||
3137 | /** |
|
3138 | * serverGroupAutoDeletePerm |