コード例 #1
0
ファイル: MQConnection.cs プロジェクト: psychobob666/safmq
        /**
         * <summary>
         * Retrieves a the list of users in a group.  The names of the users are
         * deposited into the <c>List&lt;string&gt; users</c> in the form of <c>string</c>
         * objects.
         * </summary>
         *
         * <param name="groupname">	The name of the users.</param>
         * <param name="users">		A List receiving <c>string</c> objects containing
         *      					the user's name.</param>
         *
         * <returns><c>ErrorCode.EC_NOERROR</c> upon success, otherwise errors returned
         * could be but are not limited to:<br/>
         * <table border="0" cellpadding="3" cellspacing="0">
         * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td>
         *				<td>A networking error has occurred and the conneciton
         *					is nolonger valid.
         *				</td></tr>
         * <tr><td><c>ErrorCode.EC_DOESNOTEXIST</c></td>
         *				<td>The specified group does not exist on the SAFMQ server.
         *				</td></tr>
         * </table>
         * </returns>
         */
        public ErrorCode GroupGetUsers(string groupname, List<string> users)
        {
            GROUP_CREATE_GROUP_DELETE_GROUP_GET_USERS_GROUP_GET_PERMS_PARAMS	parms = new GROUP_CREATE_GROUP_DELETE_GROUP_GET_USERS_GROUP_GET_PERMS_PARAMS();
            ErrorCode														ret = ErrorCode.EC_NETWORKERROR;

            parms.groupname = groupname;
            users.Clear();

            try {
                output.Write(Safmq.CMD_GROUP_GET_USERS);
                parms.Write(output);
                output.Flush();
                ret = getResponseCode();
                if (ret == ErrorCode.EC_NOERROR) {
                    int	nUsers;
                    int	x;
                    byte[] username = new byte[Safmq.USER_NAME_LENGTH];

                    nUsers = input.ReadInt32();
                    for(x=0;x<nUsers;x++) {
                        input.Read(username, 0,username.Length);
                        users.Add(new string(Encoding.UTF8.GetChars(username,0,ioutil.length(username))));
                    }
                }
            } catch (Exception) {
                ret = ErrorCode.EC_NETWORKERROR;
            }
            return ret;
        }
コード例 #2
0
ファイル: MQConnection.cs プロジェクト: psychobob666/safmq
        /**
         * <summary>
         * Removes the security group from the SAFMQ server.
         * </summary>
         *
         * <param name="groupname"> The name of the group</param>
         *
         * <returns><c>ErrorCode.EC_NOERROR</c> upon success, otherwise errors returned
         * could be but are not limited to:<br/>
         * <table border="0" cellpadding="3" cellspacing="0">
         * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td>
         *				<td>A networking error has occurred and the conneciton
         *					is nolonger valid.
         *				</td></tr>
         * <tr><td><c>ErrorCode.EC_NOTAUTHORIZED</c></td>
         *				<td>The current logged in user is not authorized to create groups.
         *				</td></tr>
         * <tr><td><c>ErrorCode.EC_DOESNOTEXIST</c></td>
         *				<td>The group specified does not exist.
         *				</td></tr>
         * </table>
         * </returns>
         */
        public ErrorCode DeleteGroup(string groupname)
        {
            GROUP_CREATE_GROUP_DELETE_GROUP_GET_USERS_GROUP_GET_PERMS_PARAMS	parms = new GROUP_CREATE_GROUP_DELETE_GROUP_GET_USERS_GROUP_GET_PERMS_PARAMS();
            ErrorCode														ret = ErrorCode.EC_NETWORKERROR;

            parms.groupname = groupname;
            try {
                output.Write(Safmq.CMD_GROUP_DELETE);
                parms.Write(output);
                output.Flush();
                ret = getResponseCode();
            } catch (Exception) {
                ret = ErrorCode.EC_NETWORKERROR;
            }
            return ret;
        }
コード例 #3
0
ファイル: MQConnection.cs プロジェクト: psychobob666/safmq
        /**
         * <summary>
         * Retrieves the permissions of a specific group.
         * </summary>
         *
         * <param name="groupname">     The name of the group</param>
         * <param name="actorPerms">	Receives the permissions, must not be null</param>
         *
         * <returns><c>ErrorCode.EC_NOERROR</c> upon success, otherwise errors returned
         * could be but are not limited to:<br/>
         * <table border="0" cellpadding="3" cellspacing="0">
         * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td>
         *				<td>A networking error has occurred and the conneciton
         *					is nolonger valid.
         *				</td></tr>
         * <tr><td><c>ErrorCode.EC_DOESNOTEXIST</c></td>
         *				<td>The specified group does not exist on the SAFMQ server, or no
         *					permissions have been set for that group.
         *				</td></tr>
         * </table>
         * </returns>
         */
        public ErrorCode GroupGetPermissions(string groupname, ActorPermissions actorPerms)
        {
            GROUP_CREATE_GROUP_DELETE_GROUP_GET_USERS_GROUP_GET_PERMS_PARAMS	parms = new GROUP_CREATE_GROUP_DELETE_GROUP_GET_USERS_GROUP_GET_PERMS_PARAMS();
            ErrorCode														ret = ErrorCode.EC_NETWORKERROR;

            parms.groupname = groupname;
            try {
                output.Write(Safmq.CMD_GROUP_GET_PERMS);
                parms.Write(output);
                output.Flush();
                ret = getResponseCode();
                if (ret == ErrorCode.EC_NOERROR) {
                    USER_GET_PERMS_GROUP_GET_PERMS_RESPONSE_data	perms = new USER_GET_PERMS_GROUP_GET_PERMS_RESPONSE_data();
                    perms.Read(input);
                    actorPerms.ModifyQueues = (perms.modify_queues != 0);
                    actorPerms.ModifyUsers = (perms.modify_users != 0);
                    actorPerms.ModifyGroups = (perms.modify_groups != 0);
                }
            } catch (Exception) {
                ret = ErrorCode.EC_NETWORKERROR;
            }
            return ret;
        }