Skip to content

Commit

Permalink
Add administrative features (set/retrieve groups and ACLs, channel cr…
Browse files Browse the repository at this point in the history
…eation).
  • Loading branch information
emiliopavia authored and mkrautz committed Jun 19, 2012
1 parent 1518c08 commit bf23e9d
Show file tree
Hide file tree
Showing 12 changed files with 488 additions and 21 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Thorvald Natvig <[email protected]>
Mikkel Krautz <[email protected]>
Stefan Hacker <[email protected]>
Benjamin Jemlich <[email protected]>
TOK.TV Inc.
8 changes: 8 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This is the official list of people who can contribute
// (and typically have contributed) code to MumbleKit.

Benjamin Jemlich <[email protected]>
Emilio Pavia <[email protected]>
Mikkel Krautz <[email protected]>
Stefan Hacker <[email protected]>
Thorvald Natvig <[email protected]>
42 changes: 42 additions & 0 deletions MumbleKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@
28CC3717132EDC7300241269 /* libSpeexDSP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 28CC3712132EDC7300241269 /* libSpeexDSP.a */; };
28F2FAD513E37BA000034BF2 /* MKAudioOutputUserPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 28F2FAD413E37BA000034BF2 /* MKAudioOutputUserPrivate.h */; };
28F2FAD613E37BA000034BF2 /* MKAudioOutputUserPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 28F2FAD413E37BA000034BF2 /* MKAudioOutputUserPrivate.h */; };
BCD11DF2158F3FD600321E06 /* MKPermission.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF1158F3FD600321E06 /* MKPermission.h */; };
BCD11DF3158F3FD600321E06 /* MKPermission.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF1158F3FD600321E06 /* MKPermission.h */; };
BCD11DF7158F40A900321E06 /* MKAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF4158F40A900321E06 /* MKAccessControl.h */; };
BCD11DF8158F40A900321E06 /* MKAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF4158F40A900321E06 /* MKAccessControl.h */; };
BCD11DF9158F40A900321E06 /* MKChannelACL.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF5158F40A900321E06 /* MKChannelACL.h */; };
BCD11DFA158F40A900321E06 /* MKChannelACL.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF5158F40A900321E06 /* MKChannelACL.h */; };
BCD11DFB158F40A900321E06 /* MKChannelGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF6158F40A900321E06 /* MKChannelGroup.h */; };
BCD11DFC158F40A900321E06 /* MKChannelGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD11DF6158F40A900321E06 /* MKChannelGroup.h */; };
BCD11E09158F40FA00321E06 /* MKAccessControl.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD11E06158F40FA00321E06 /* MKAccessControl.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
BCD11E0A158F40FA00321E06 /* MKAccessControl.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD11E06158F40FA00321E06 /* MKAccessControl.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
BCD11E0B158F40FA00321E06 /* MKChannelACL.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD11E07158F40FA00321E06 /* MKChannelACL.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
BCD11E0C158F40FA00321E06 /* MKChannelACL.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD11E07158F40FA00321E06 /* MKChannelACL.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
BCD11E0D158F40FA00321E06 /* MKChannelGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD11E08158F40FA00321E06 /* MKChannelGroup.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
BCD11E0E158F40FA00321E06 /* MKChannelGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD11E08158F40FA00321E06 /* MKChannelGroup.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -396,6 +410,13 @@
28CC3711132EDC7300241269 /* libSpeex.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libSpeex.a; sourceTree = BUILT_PRODUCTS_DIR; };
28CC3712132EDC7300241269 /* libSpeexDSP.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libSpeexDSP.a; sourceTree = BUILT_PRODUCTS_DIR; };
28F2FAD413E37BA000034BF2 /* MKAudioOutputUserPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKAudioOutputUserPrivate.h; path = src/MKAudioOutputUserPrivate.h; sourceTree = SOURCE_ROOT; };
BCD11DF1158F3FD600321E06 /* MKPermission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKPermission.h; path = src/MumbleKit/MKPermission.h; sourceTree = SOURCE_ROOT; };
BCD11DF4158F40A900321E06 /* MKAccessControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKAccessControl.h; path = src/MumbleKit/MKAccessControl.h; sourceTree = SOURCE_ROOT; };
BCD11DF5158F40A900321E06 /* MKChannelACL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKChannelACL.h; path = src/MumbleKit/MKChannelACL.h; sourceTree = SOURCE_ROOT; };
BCD11DF6158F40A900321E06 /* MKChannelGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKChannelGroup.h; path = src/MumbleKit/MKChannelGroup.h; sourceTree = SOURCE_ROOT; };
BCD11E06158F40FA00321E06 /* MKAccessControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MKAccessControl.m; path = src/MKAccessControl.m; sourceTree = SOURCE_ROOT; };
BCD11E07158F40FA00321E06 /* MKChannelACL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MKChannelACL.m; path = src/MKChannelACL.m; sourceTree = SOURCE_ROOT; };
BCD11E08158F40FA00321E06 /* MKChannelGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MKChannelGroup.m; path = src/MKChannelGroup.m; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -485,6 +506,7 @@
28CC36F8132ED92500241269 /* Mumble.pb.m */,
28CC36F9132ED92500241269 /* ObjectivecDescriptor.pb.m */,
2845A781132D9C220034D631 /* CryptState.cpp */,
BCD11E06158F40FA00321E06 /* MKAccessControl.m */,
2845A782132D9C220034D631 /* MKAudio.m */,
2845A783132D9C220034D631 /* MKAudioInput.m */,
2845A784132D9C220034D631 /* MKAudioOutput.m */,
Expand All @@ -493,6 +515,8 @@
2845A786132D9C220034D631 /* MKAudioOutputUser.m */,
2845A787132D9C220034D631 /* MKCertificate.m */,
2845A788132D9C220034D631 /* MKChannel.m */,
BCD11E07158F40FA00321E06 /* MKChannelACL.m */,
BCD11E08158F40FA00321E06 /* MKChannelGroup.m */,
2845A789132D9C220034D631 /* MKConnection.m */,
2845A78A132D9C220034D631 /* MKConnectionController.m */,
2845A78B132D9C220034D631 /* MKCryptState_openssl.mm */,
Expand All @@ -512,11 +536,15 @@
2845A780132D9BF50034D631 /* Public Headers */ = {
isa = PBXGroup;
children = (
BCD11DF4158F40A900321E06 /* MKAccessControl.h */,
2845A7C7132D9C520034D631 /* MKAudio.h */,
2845A7CC132D9C520034D631 /* MKCertificate.h */,
2845A7CD132D9C520034D631 /* MKChannel.h */,
BCD11DF5158F40A900321E06 /* MKChannelACL.h */,
BCD11DF6158F40A900321E06 /* MKChannelGroup.h */,
2845A7CE132D9C520034D631 /* MKConnection.h */,
2845A7CF132D9C520034D631 /* MKConnectionController.h */,
BCD11DF1158F3FD600321E06 /* MKPermission.h */,
2845A7D3132D9C520034D631 /* MKServerModel.h */,
282F6B0613624187008F555B /* MKServerPinger.h */,
2845A7D5132D9C520034D631 /* MKServices.h */,
Expand Down Expand Up @@ -685,6 +713,10 @@
2879526914C1BDD800567430 /* MKTextMessage.h in Headers */,
281EADA61530EA30000793AB /* MKDistinguishedNameParser.h in Headers */,
28074E91158A6E5100E0A4D0 /* MKAudioOutputSidetone.h in Headers */,
BCD11DF3158F3FD600321E06 /* MKPermission.h in Headers */,
BCD11DF8158F40A900321E06 /* MKAccessControl.h in Headers */,
BCD11DFA158F40A900321E06 /* MKChannelACL.h in Headers */,
BCD11DFC158F40A900321E06 /* MKChannelGroup.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -717,6 +749,10 @@
2879526814C1BDD800567430 /* MKTextMessage.h in Headers */,
281EADA51530EA30000793AB /* MKDistinguishedNameParser.h in Headers */,
28074E90158A6E5100E0A4D0 /* MKAudioOutputSidetone.h in Headers */,
BCD11DF2158F3FD600321E06 /* MKPermission.h in Headers */,
BCD11DF7158F40A900321E06 /* MKAccessControl.h in Headers */,
BCD11DF9158F40A900321E06 /* MKChannelACL.h in Headers */,
BCD11DFB158F40A900321E06 /* MKChannelGroup.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -948,6 +984,9 @@
2879526514C1BAB900567430 /* MKTextMessage.m in Sources */,
281EADA81530EA30000793AB /* MKDistinguishedNameParser.m in Sources */,
28074E93158A6E5100E0A4D0 /* MKAudioOutputSidetone.m in Sources */,
BCD11E0A158F40FA00321E06 /* MKAccessControl.m in Sources */,
BCD11E0C158F40FA00321E06 /* MKChannelACL.m in Sources */,
BCD11E0E158F40FA00321E06 /* MKChannelGroup.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -978,6 +1017,9 @@
2879526414C1BAB900567430 /* MKTextMessage.m in Sources */,
281EADA71530EA30000793AB /* MKDistinguishedNameParser.m in Sources */,
28074E92158A6E5100E0A4D0 /* MKAudioOutputSidetone.m in Sources */,
BCD11E09158F40FA00321E06 /* MKAccessControl.m in Sources */,
BCD11E0B158F40FA00321E06 /* MKChannelACL.m in Sources */,
BCD11E0D158F40FA00321E06 /* MKChannelGroup.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
17 changes: 17 additions & 0 deletions src/MKAccessControl.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2012 The MumbleKit Developers. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#import "MKAccessControl.h"

@implementation MKAccessControl

@synthesize inheritACLs;
@synthesize groups;
@synthesize acls;

- (NSString *) description {
return [NSString stringWithFormat:@"{\n\tinheritACLs: %@\n\tgroups: %@\n\tacls: %@\n}", self.inheritACLs ? @"YES" : @"NO", self.groups, self.acls];
}

@end
146 changes: 146 additions & 0 deletions src/MKChannelACL.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// Copyright 2012 The MumbleKit Developers. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#import "MKChannelACL.h"

@implementation MKChannelACL

@synthesize applyHere;
@synthesize applySubs;
@synthesize inherited;
@synthesize userID;
@synthesize group;
@synthesize grant;
@synthesize deny;

- (BOOL) hasUserID {
return (self.userID > -1);
}

- (NSString *) description {
NSMutableString *grantDescription = [[NSMutableString alloc] init];
if (self.grant == MKPermissionAll) {
[grantDescription appendString:@"All"];
} else if (self.grant == MKPermissionNone) {
[grantDescription appendString:@"None"];
} else {
if ((self.grant & MKPermissionWrite) == MKPermissionWrite) {
[grantDescription appendString:@"Write | "];
}
if ((self.grant & MKPermissionTraverse) == MKPermissionTraverse) {
[grantDescription appendString:@"Traverse | "];
}
if ((self.grant & MKPermissionEnter) == MKPermissionEnter) {
[grantDescription appendString:@"Enter | "];
}
if ((self.grant & MKPermissionSpeak) == MKPermissionSpeak) {
[grantDescription appendString:@"Speak | "];
}
if ((self.grant & MKPermissionMuteDeafen) == MKPermissionMuteDeafen) {
[grantDescription appendString:@"MuteDeafen | "];
}
if ((self.grant & MKPermissionMove) == MKPermissionMove) {
[grantDescription appendString:@"Move | "];
}
if ((self.grant & MKPermissionMakeChannel) == MKPermissionMakeChannel) {
[grantDescription appendString:@"MakeChannel | "];
}
if ((self.grant & MKPermissionLinkChannel) == MKPermissionLinkChannel) {
[grantDescription appendString:@"LinkChannel | "];
}
if ((self.grant & MKPermissionWhisper) == MKPermissionWhisper) {
[grantDescription appendString:@"Whisper | "];
}
if ((self.grant & MKPermissionTextMessage) == MKPermissionTextMessage) {
[grantDescription appendString:@"TextMessage | "];
}
if ((self.grant & MKPermissionMakeTempChannel) == MKPermissionMakeTempChannel) {
[grantDescription appendString:@"MakeTempChannel | "];
}
if ((self.grant & MKPermissionKick) == MKPermissionKick) {
[grantDescription appendString:@"Kick | "];
}
if ((self.grant & MKPermissionBan) == MKPermissionBan) {
[grantDescription appendString:@"Ban | "];
}
if ((self.grant & MKPermissionRegister) == MKPermissionRegister) {
[grantDescription appendString:@"Register | "];
}
if ((self.grant & MKPermissionSelfRegister) == MKPermissionSelfRegister) {
[grantDescription appendString:@"SelfRegister | "];
}

if (grantDescription.length > 0) {
grantDescription = [NSMutableString stringWithString:[grantDescription substringToIndex:grantDescription.length-3]];
}
}

NSMutableString *denyDescription = [[NSMutableString alloc] init];
if (self.deny == MKPermissionAll) {
[denyDescription appendString:@"All"];
} else if (self.deny == MKPermissionNone) {
[denyDescription appendString:@"None"];
} else {
if ((self.deny & MKPermissionWrite) == MKPermissionWrite) {
[denyDescription appendString:@"Write | "];
}
if ((self.deny & MKPermissionTraverse) == MKPermissionTraverse) {
[denyDescription appendString:@"Traverse | "];
}
if ((self.deny & MKPermissionEnter) == MKPermissionEnter) {
[denyDescription appendString:@"Enter | "];
}
if ((self.deny & MKPermissionSpeak) == MKPermissionSpeak) {
[denyDescription appendString:@"Speak | "];
}
if ((self.deny & MKPermissionMuteDeafen) == MKPermissionMuteDeafen) {
[denyDescription appendString:@"MuteDeafen | "];
}
if ((self.deny & MKPermissionMove) == MKPermissionMove) {
[denyDescription appendString:@"Move | "];
}
if ((self.deny & MKPermissionMakeChannel) == MKPermissionMakeChannel) {
[denyDescription appendString:@"MakeChannel | "];
}
if ((self.deny & MKPermissionLinkChannel) == MKPermissionLinkChannel) {
[denyDescription appendString:@"LinkChannel | "];
}
if ((self.deny & MKPermissionWhisper) == MKPermissionWhisper) {
[denyDescription appendString:@"Whisper | "];
}
if ((self.deny & MKPermissionTextMessage) == MKPermissionTextMessage) {
[denyDescription appendString:@"TextMessage | "];
}
if ((self.deny & MKPermissionMakeTempChannel) == MKPermissionMakeTempChannel) {
[denyDescription appendString:@"MakeTempChannel | "];
}
if ((self.deny & MKPermissionKick) == MKPermissionKick) {
[denyDescription appendString:@"Kick | "];
}
if ((self.deny & MKPermissionBan) == MKPermissionBan) {
[denyDescription appendString:@"Ban | "];
}
if ((self.deny & MKPermissionRegister) == MKPermissionRegister) {
[denyDescription appendString:@"Register | "];
}
if ((self.deny & MKPermissionSelfRegister) == MKPermissionSelfRegister) {
[denyDescription appendString:@"SelfRegister | "];
}

if (denyDescription.length > 0) {
denyDescription = [NSMutableString stringWithString:[denyDescription substringToIndex:denyDescription.length-3]];
}
}

return [NSString stringWithFormat:@"{applyHere: %@; applySubs: %@; inherited: %@; %@: %@; grant: %@; deny: %@}",
self.applyHere ? @"YES" : @"NO",
self.applySubs ? @"YES" : @"NO",
self.inherited ? @"YES" : @"NO",
self.hasUserID ? @"userID" : @"group",
self.hasUserID ? [NSNumber numberWithInt:self.userID] : self.group,
grantDescription,
denyDescription];
}

@end
27 changes: 27 additions & 0 deletions src/MKChannelGroup.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2012 The MumbleKit Developers. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#import "MKChannelGroup.h"

@implementation MKChannelGroup

@synthesize name;
@synthesize inherited;
@synthesize inherit;
@synthesize inheritable;
@synthesize members;
@synthesize excludedMembers;
@synthesize inheritedMembers;

- (NSString *) description {
return [NSString stringWithFormat:@"{name: %@; inherited: %@; inherit: %@; inheritable: %@; members: %@; excludedMembers: %@; inheritedMembers: %@}",
self.name,
self.inherited ? @"YES" : @"NO",
self.inherit ? @"YES" : @"NO",
self.inheritable ? @"YES" : @"NO",
self.members,
self.excludedMembers,
self.inheritedMembers];
}
@end
Loading

0 comments on commit bf23e9d

Please sign in to comment.