Skip to content

Commit c43b488

Browse files
committed
Reorg some of the scope code, and add a few more helper methods.
1 parent 71c4f2b commit c43b488

File tree

9 files changed

+165
-52
lines changed

9 files changed

+165
-52
lines changed

scopes/calendars.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@ var (
44
// ApplicationCalendarsRead Read calendars in all mailboxes
55
ApplicationCalendarsRead = Scope{
66
AdminConsentRequired: true,
7-
Application: true,
87
Description: "Allows the app to read events of all calendars without a signed-in user.",
98
DisplayString: "Read calendars in all mailboxes",
109
Permission: "Calendars.Read",
10+
Type: PermissionTypeApplication,
1111
}
1212
// ApplicationCalendarsReadWrite Read and write calendars in all mailboxes
1313
ApplicationCalendarsReadWrite = Scope{
1414
AdminConsentRequired: true,
15-
Application: true,
1615
Description: "Allows the app to create, read, update, and delete events of all calendars without a signed-in user.",
1716
DisplayString: "Read and write calendars in all mailboxes",
1817
Permission: "Calendars.ReadWrite",
18+
Type: PermissionTypeApplication,
1919
}
2020
// DelegatedCalendarsRead Read user calendars
2121
DelegatedCalendarsRead = Scope{
22-
Delegated: true,
2322
Description: "Allows the app to read events in user calendars.",
2423
DisplayString: "Read user calendars",
2524
Permission: "Calendars.Read",
25+
Type: PermissionTypeDelegated,
2626
}
2727
// DelegatedCalendarsReadShared Read user and shared calendars
2828
DelegatedCalendarsReadShared = Scope{
29-
Delegated: true,
3029
Description: "Allows the app to read events in all calendars that the user can access, including delegate and shared calendars.",
3130
DisplayString: "Read user and shared calendars",
3231
Permission: "Calendars.Read.Shared",
32+
Type: PermissionTypeDelegated,
3333
}
3434
// DelegatedCalendarsReadWrite Have full access to user calendars
3535
DelegatedCalendarsReadWrite = Scope{
36-
Delegated: true,
3736
Description: "Allows the app to create, read, update, and delete events in user calendars.",
3837
DisplayString: "Have full access to user calendars",
3938
Permission: "Calendars.ReadWrite",
39+
Type: PermissionTypeDelegated,
4040
}
4141
// DelegatedCalendarsReadWriteShared Read and write user and shared calendars
4242
DelegatedCalendarsReadWriteShared = Scope{
43-
Delegated: true,
4443
Description: "Allows the app to create, read, update and delete events in all calendars the user has permissions to access. This includes delegate and shared calendars.",
4544
DisplayString: "Read and write user and shared calendars",
4645
Permission: "Calendars.ReadWrite.Shared",
46+
Type: PermissionTypeDelegated,
4747
}
4848
)

scopes/contacts.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@ var (
44
// ApplicationContactsRead Read contacts in all mailboxes
55
ApplicationContactsRead = Scope{
66
AdminConsentRequired: true,
7-
Application: true,
87
Description: "Allows the app to read all contacts in all mailboxes without a signed-in user.",
98
DisplayString: "Read contacts in all mailboxes",
109
Permission: "Contacts.Read",
10+
Type: PermissionTypeApplication,
1111
}
1212
// ApplicationContactsReadWrite Read and write contacts in all mailboxes
1313
ApplicationContactsReadWrite = Scope{
1414
AdminConsentRequired: true,
15-
Application: true,
1615
Description: "Allows the app to create, read, update, and delete all contacts in all mailboxes without a signed-in user.",
1716
DisplayString: "Read and write contacts in all mailboxes",
1817
Permission: "Contacts.ReadWrite",
18+
Type: PermissionTypeApplication,
1919
}
2020
// DelegatedContactsRead Read user contacts
2121
DelegatedContactsRead = Scope{
22-
Delegated: true,
2322
Description: "Allows the app to read user contacts.",
2423
DisplayString: "Read user contacts",
2524
Permission: "Contacts.Read",
25+
Type: PermissionTypeDelegated,
2626
}
2727
// DelegatedContactsReadShared Read user and shared contacts
2828
DelegatedContactsReadShared = Scope{
29-
Delegated: true,
3029
Description: "Allows the app to read contacts that the user has permissions to access, including the user's own and shared contacts.",
3130
DisplayString: "Read user and shared contacts",
3231
Permission: "Contacts.Read.Shared",
32+
Type: PermissionTypeDelegated,
3333
}
3434
// DelegatedContactsReadWrite Have full access to user contacts
3535
DelegatedContactsReadWrite = Scope{
36-
Delegated: true,
3736
Description: "Allows the app to create, read, update, and delete user contacts.",
3837
DisplayString: "Have full access to user contacts",
3938
Permission: "Contacts.ReadWrite",
39+
Type: PermissionTypeDelegated,
4040
}
4141
// DelegatedContactsReadWriteShared Read and write user and shared contacts
4242
DelegatedContactsReadWriteShared = Scope{
43-
Delegated: true,
4443
Description: "Allows the app to create, read, update and delete contacts that the user has permissions to, including the user's own and shared contacts.",
4544
DisplayString: "Read and write user and shared contacts",
4645
Permission: "Contacts.ReadWrite.Shared",
46+
Type: PermissionTypeDelegated,
4747
}
4848
)

scopes/device.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ var (
44
// ApplicationDeviceReadWriteAll Read and write devices
55
ApplicationDeviceReadWriteAll = Scope{
66
AdminConsentRequired: true,
7-
Application: true,
87
Description: "Allows the app to read and write all device properties without a signed in user. Does not allow device creation, device deletion, or update of device alternative security identifiers.",
98
DisplayString: "Read and write devices",
109
Permission: "Device.ReadWrite.All",
10+
Type: PermissionTypeApplication,
1111
}
1212
// DelegatedDeviceRead Read user devices
1313
DelegatedDeviceRead = Scope{
14-
Delegated: true,
1514
Description: "Allows the app to read a user's list of devices on behalf of the signed-in user.",
1615
DisplayString: "Read user devices",
1716
Permission: "Device.Read",
17+
Type: PermissionTypeDelegated,
1818
}
1919
// DelegatedDeviceCommand Communicate with user devices
2020
DelegatedDeviceCommand = Scope{
21-
Delegated: true,
2221
Description: "Allows the app to launch another app or communicate with another app on a user's device on behalf of the signed-in user.",
2322
DisplayString: "Communicate with user devices",
2423
Permission: "Device.Command",
24+
Type: PermissionTypeDelegated,
2525
}
2626
)

scopes/directory.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,41 @@ var (
44
// ApplicationDirectoryReadAll Read directory data
55
ApplicationDirectoryReadAll = Scope{
66
AdminConsentRequired: true,
7-
Application: true,
87
DisplayString: "Read directory data",
98
Description: "Allows the app to read data in your organization's directory, such as users, groups and apps, without a signed-in user.",
109
Permission: "Directory.Read.All",
10+
Type: PermissionTypeApplication,
1111
}
1212
// ApplicationDirectoryReadWriteAll Read and write directory data
1313
ApplicationDirectoryReadWriteAll = Scope{
1414
AdminConsentRequired: true,
15-
Application: true,
1615
DisplayString: "Read and write directory data",
1716
Description: "Allows the app to read and write data in your organization's directory, such as users, and groups, without a signed-in user. Does not allow user or group deletion.",
1817
Permission: "Directory.ReadWrite.All",
18+
Type: PermissionTypeApplication,
1919
}
2020
// DelegatedDirectoryReadAll Read directory data
2121
DelegatedDirectoryReadAll = Scope{
2222
AdminConsentRequired: true,
23-
Delegated: true,
2423
DisplayString: "Read directory data",
2524
Description: "Allows the app to read data in your organization's directory, such as users, groups and apps. Note: Users may consent to applications that require this permission if the application is registered in their own organization’s tenant.",
2625
Permission: "Directory.Read.All",
26+
Type: PermissionTypeDelegated,
2727
}
2828
// DelegatedDirectoryReadWriteAll Read and write directory data
2929
DelegatedDirectoryReadWriteAll = Scope{
3030
AdminConsentRequired: true,
31-
Delegated: true,
3231
DisplayString: "Read and write directory data",
3332
Description: "Allows the app to read and write data in your organization's directory, such as users, and groups. It does not allow the app to delete users or groups, or reset user passwords.",
3433
Permission: "Directory.ReadWrite.All",
34+
Type: PermissionTypeDelegated,
3535
}
3636
// DelegatedDirectoryAccessAsUser Access directory as the signed-in user
3737
DelegatedDirectoryAccessAsUser = Scope{
3838
AdminConsentRequired: true,
39-
Delegated: true,
4039
DisplayString: "Access directory as the signed-in user",
4140
Description: "Allows the app to have the same access to information in the directory as the signed-in user.",
4241
Permission: "Directory.AccessAsUser.All",
42+
Type: PermissionTypeDelegated,
4343
}
4444
)

scopes/intune_device_management.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,89 @@ var (
44
// DelegatedDeviceManagementAppsReadAll Read Microsoft Intune apps
55
DelegatedDeviceManagementAppsReadAll = Scope{
66
AdminConsentRequired: true,
7-
Delegated: true,
87
Description: "Allows the app to read the properties, group assignments and status of apps, app configurations and app protection policies managed by Microsoft Intune.",
98
DisplayString: "Read Microsoft Intune apps",
109
Permission: "DeviceManagementApps.Read.All",
10+
Type: PermissionTypeDelegated,
1111
}
1212
// DelegatedDeviceManagementAppsReadWriteAll Read and write Microsoft Intune apps
1313
DelegatedDeviceManagementAppsReadWriteAll = Scope{
1414
AdminConsentRequired: true,
15-
Delegated: true,
1615
Description: "Allows the app to read and write the properties, group assignments and status of apps, app configurations and app protection policies managed by Microsoft Intune.",
1716
DisplayString: "Read and write Microsoft Intune apps",
1817
Permission: "DeviceManagementApps.ReadWrite.All",
18+
Type: PermissionTypeDelegated,
1919
}
2020
// DelegatedDeviceManagementConfigurationReadAll Read Microsoft Intune device configuration and policies
2121
DelegatedDeviceManagementConfigurationReadAll = Scope{
2222
AdminConsentRequired: true,
23-
Delegated: true,
2423
Description: "Allows the app to read properties of Microsoft Intune-managed device configuration and device compliance policies and their assignment to groups.",
2524
DisplayString: "Read Microsoft Intune device configuration and policies",
2625
Permission: "DeviceManagementConfiguration.Read.All",
26+
Type: PermissionTypeDelegated,
2727
}
2828
// DelegatedDeviceManagementConfigurationReadWriteAll "Read and write Microsoft Intune device configuration and policies"
2929
DelegatedDeviceManagementConfigurationReadWriteAll = Scope{
3030
AdminConsentRequired: true,
31-
Delegated: true,
3231
Description: "Allows the app to read and write properties of Microsoft Intune-managed device configuration and device compliance policies and their assignment to groups.",
3332
DisplayString: "Read and write Microsoft Intune device configuration and policies",
3433
Permission: "DeviceManagementConfiguration.ReadWrite.All",
34+
Type: PermissionTypeDelegated,
3535
}
3636
// DelegatedDeviceManagementManagedDevicesPrivilegedOperationsAll Perform user-impacting remote actions on Microsoft Intune devices
3737
DelegatedDeviceManagementManagedDevicesPrivilegedOperationsAll = Scope{
3838
AdminConsentRequired: true,
39-
Delegated: true,
4039
Description: "Allows the app to perform remote high impact actions such as wiping the device or resetting the passcode on devices managed by Microsoft Intune.",
4140
DisplayString: "Perform user-impacting remote actions on Microsoft Intune devices",
4241
Permission: "DeviceManagementManagedDevices.PrivilegedOperations.All",
42+
Type: PermissionTypeDelegated,
4343
}
4444
// DelegatedDeviceManagementManagedDevicesReadAll Read Microsoft Intune devices
4545
DelegatedDeviceManagementManagedDevicesReadAll = Scope{
4646
AdminConsentRequired: true,
47-
Delegated: true,
4847
Description: "Allows the app to read the properties of devices managed by Microsoft Intune.",
4948
DisplayString: "Read Microsoft Intune devices",
5049
Permission: "DeviceManagementManagedDevices.Read.All",
50+
Type: PermissionTypeDelegated,
5151
}
5252
// DelegatedDeviceManagementManagedDevicesReadWriteAll Read and write Microsoft Intune devices
5353
DelegatedDeviceManagementManagedDevicesReadWriteAll = Scope{
5454
AdminConsentRequired: true,
55-
Delegated: true,
5655
Description: "Allows the app to read and write the properties of devices managed by Microsoft Intune. Does not allow high impact operations such as remote wipe and password reset on the device’s owner.",
5756
DisplayString: "Read and write Microsoft Intune devices",
5857
Permission: "DeviceManagementManagedDevices.ReadWrite.All",
58+
Type: PermissionTypeDelegated,
5959
}
6060
// DelegatedDeviceManagementRBACReadAll Read Microsoft Intune RBAC settings
6161
DelegatedDeviceManagementRBACReadAll = Scope{
6262
AdminConsentRequired: true,
63-
Delegated: true,
6463
Description: "Allows the app to read the properties relating to the Microsoft Intune Role-Based Access Control (RBAC) settings.",
6564
DisplayString: "Read Microsoft Intune RBAC settings",
6665
Permission: "DeviceManagementRBAC.Read.All",
66+
Type: PermissionTypeDelegated,
6767
}
6868
// DelegatedDeviceManagementRBACReadWriteAll Read and write Microsoft Intune RBAC settings
6969
DelegatedDeviceManagementRBACReadWriteAll = Scope{
7070
AdminConsentRequired: true,
71-
Delegated: true,
7271
Description: "Allows the app to read and write the properties relating to the Microsoft Intune Role-Based Access Control (RBAC) settings.",
7372
DisplayString: "Read and write Microsoft Intune RBAC settings",
7473
Permission: "DeviceManagementRBAC.ReadWrite.All",
74+
Type: PermissionTypeDelegated,
7575
}
7676
// DelegatedDeviceManagementServiceConfigReadAll Read Microsoft Intune configuration
7777
DelegatedDeviceManagementServiceConfigReadAll = Scope{
7878
AdminConsentRequired: true,
79-
Delegated: true,
8079
Description: "Allows the app to read Intune service properties including device enrollment and third party service connection configuration.",
8180
DisplayString: "Read Microsoft Intune configuration",
8281
Permission: "DeviceManagementServiceConfig.Read.All",
82+
Type: PermissionTypeDelegated,
8383
}
8484
// DelegatedDeviceManagementServiceConfigReadWriteAll Read and write Microsoft Intune configuration
8585
DelegatedDeviceManagementServiceConfigReadWriteAll = Scope{
8686
AdminConsentRequired: true,
87-
Delegated: true,
8887
Description: "Allows the app to read and write Microsoft Intune service properties including device enrollment and third party service connection configuration.",
8988
DisplayString: "Read and write Microsoft Intune configuration",
9089
Permission: "DeviceManagementServiceConfig.ReadWrite.All",
90+
Type: PermissionTypeDelegated,
9191
}
9292
)

scopes/open_id.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@ package scopes
33
var (
44
// DelegatedEmail View users' email address
55
DelegatedEmail = Scope{
6-
Delegated: true,
76
Description: "Allows the app to read your users' primary email address.",
87
DisplayString: "View users' email address",
98
Permission: "email",
9+
Type: PermissionTypeDelegated,
1010
}
1111
// DelegatedOfflineAccess Access user's data anytime
1212
DelegatedOfflineAccess = Scope{
13-
Delegated: true,
1413
Description: "Allows the app to read and update user data, even when they are not currently using the app.",
1514
DisplayString: "Access user's data anytime",
1615
Permission: "offline_access",
16+
Type: PermissionTypeDelegated,
1717
}
1818
// DelegatedOpenID Sign users in
1919
DelegatedOpenID = Scope{
20-
Delegated: true,
2120
Description: "Allows users to sign in to the app with their work or school accounts and allows the app to see basic user profile information.",
2221
DisplayString: "Sign users in",
2322
Permission: "openid",
23+
Type: PermissionTypeDelegated,
2424
}
2525
// DelegatedProfile View users' basic profile
2626
DelegatedProfile = Scope{
27-
Delegated: true,
2827
Description: "Allows the app to see your users' basic profile (name, picture, user name).",
2928
DisplayString: "View users' basic profile",
3029
Permission: "profile",
30+
Type: PermissionTypeDelegated,
3131
}
3232
)

scopes/people.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ var (
44
// ApplicationPeopleReadAll Read all users' relevant people lists
55
ApplicationPeopleReadAll = Scope{
66
AdminConsentRequired: true,
7-
Application: true,
87
Description: "Allows the app to read a scored list of people relevant to the signed-in user or other users in the signed-in user's organization. The list can include local contacts, contacts from social networking or your organization's directory, and people from recent communications (such as email and Skype). Also allows the app to search the entire directory of the signed-in user's organization.",
98
DisplayString: "Read all users' relevant people lists",
109
Permission: "People.Read.All",
10+
Type: PermissionTypeApplication,
1111
}
1212
// DelegatedPeopleRead Read users' relevant people lists
1313
DelegatedPeopleRead = Scope{
14-
Delegated: true,
1514
Description: "Allows the app to read a scored list of people relevant to the signed-in user. The list can include local contacts, contacts from social networking or your organization's directory, and people from recent communications (such as email and Skype).",
1615
DisplayString: "Read users' relevant people lists",
1716
Permission: "People.Read",
17+
Type: PermissionTypeDelegated,
1818
}
1919
// DelegatedPeopleReadAll Read all users' relevant people lists
2020
DelegatedPeopleReadAll = Scope{
2121
AdminConsentRequired: true,
22-
Delegated: true,
2322
Description: "Allows the app to read a scored list of people relevant to the signed-in user or other users in the signed-in user's organization. The list can include local contacts, contacts from social networking or your organization's directory, and people from recent communications (such as email and Skype). Also allows the app to search the entire directory of the signed-in user's organization.",
2423
DisplayString: "Read all users' relevant people lists",
2524
Permission: "People.Read.All",
25+
Type: PermissionTypeDelegated,
2626
}
2727
)

0 commit comments

Comments
 (0)