Jump to content

Auditing user classes and auditing with SQL

Recommended Posts

Memorializing from CWSupport...

-- Users have SuperAdmin
SELECT `users`.`UserID`, `users`.`Name`, IF((BIT_OR(`userclasses`.`Permissions`) & (1 << 0) = (1 << 0)), 'True', 'False') AS 'SuperAdmin', COUNT(`userclasses`.`name`) AS 'Class Count'
FROM `users` 
LEFT JOIN `userclasses` ON FIND_IN_SET(`userclasses`.ClassID, `users`.`ClientID`) 
WHERE  `users`.`Name` != 'root'
GROUP BY `users`.`UserID`;

-- Auditing not set to Everything
SELECT `users`.`Name` 
FROM `users` 
WHERE `AuditLevel` != 5 AND `users`.`Name` != 'root';

-- Audit Users by User Class Membership
   users.name AS `Username`,
   GROUP_CONCAT(uc.classname SEPARATOR ", ") AS Classes
FROM users,
(SELECT classid,`Name` AS classname FROM userclasses) AS uc
WHERE FIND_IN_SET(uc.classid,users.clientid)
GROUP BY username
ORDER BY users.Name;


  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...