// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise.
430089
func (l *License) GetPermissions() []string {
	if l == nil || l.Permissions == nil {
		return nil
	}
	return *l.Permissions
}
472378
func OperPermissions() []Permission {
	ps := []Permission{}
	for _, r := range AllResourceTypes {
		for _, a := range actions {
			ps = append(ps, Permission{Action: a, Resource: Resource{Type: r}})
		}
	}

	return ps
}
224832
func (c *Client) Permissions(context.Context) chronograf.Permissions {
	return chronograf.Permissions{
		{
			Scope:   chronograf.AllScope,
			Allowed: AllowAllAdmin,
		},
		{
			Scope:   chronograf.DBScope,
			Allowed: AllowAllDB,
		},
	}
}
753071
func (e *Enforcer) DeletePermissionForUser(user string, permission ...string) bool {
	params := make([]interface{}, 0, len(permission)+1)

	params = append(params, user)
	for _, perm := range permission {
		params = append(params, perm)
	}

	return e.RemovePolicy(params...)
}
1127105
func (s *ListPermissionsOutput) SetPermissions(v []*Permission) *ListPermissionsOutput {
	s.Permissions = v
	return s
}
1017794
func (c *client) setPermissions(perms *Permissions) {
	if perms == nil {
		return
	}
	c.perms = &permissions{}
	c.perms.pcache = make(map[string]bool)

	// Loop over publish permissions
	if perms.Publish != nil {
		if len(perms.Publish.Allow) > 0 {
			c.perms.pub.allow = NewSublist()
		}
		for _, pubSubject := range perms.Publish.Allow {
			sub := &subscription{subject: []byte(pubSubject)}
			c.perms.pub.allow.Insert(sub)
		}
		if len(perms.Publish.Deny) > 0 {
			c.perms.pub.deny = NewSublist()
		}
		for _, pubSubject := range perms.Publish.Deny {
			sub := &subscription{subject: []byte(pubSubject)}
			c.perms.pub.deny.Insert(sub)
		}
	}

	// Loop over subscribe permissions
	if perms.Subscribe != nil {
		if len(perms.Subscribe.Allow) > 0 {
			c.perms.sub.allow = NewSublist()
		}
		for _, subSubject := range perms.Subscribe.Allow {
			sub := &subscription{subject: []byte(subSubject)}
			c.perms.sub.allow.Insert(sub)
		}
		if len(perms.Subscribe.Deny) > 0 {
			c.perms.sub.deny = NewSublist()
			// Also hold onto this array for later.
			c.darray = perms.Subscribe.Deny
		}
		for _, subSubject := range perms.Subscribe.Deny {
			sub := &subscription{subject: []byte(subSubject)}
			c.perms.sub.deny.Insert(sub)
		}
	}
}
92275
func Perms(argv []string) error {
	usage := `
Valid commands for perms:

perms:list            list permissions granted on an app
perms:create          create a new permission for a user
perms:delete          delete a permission for a user

Use 'deis help perms:[command]' to learn more.
`
	switch argv[0] {
	case "perms:list":
		return permsList(argv)
	case "perms:create":
		return permCreate(argv)
	case "perms:delete":
		return permDelete(argv)
	default:
		if printHelp(argv, usage) {
			return nil
		}

		if argv[0] == "perms" {
			argv[0] = "perms:list"
			return permsList(argv)
		}

		PrintUsage()
		return nil
	}
}
587664
func (s *FileSystemStorage) SaveWithPermissions(filepath string, file File, perm os.FileMode) error {
	_, err := os.Stat(s.Location)

	if err != nil {
		return err
	}

	location := s.Path(filepath)

	basename := location[:strings.LastIndex(location, "/")+1]

	err = os.MkdirAll(basename, perm)

	if err != nil {
		return err
	}

	content, err := file.ReadAll()

	if err != nil {
		return err
	}

	err = ioutil.WriteFile(location, content, perm)

	return err
}
299794
func (p *ProjectCollaboratorOptions) GetPermission() string {
	if p == nil || p.Permission == nil {
		return ""
	}
	return *p.Permission
}
1348734
func (r *ServerService) Permissions() *ServerPermissionsCall {
	c := &ServerPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}
561428
func (s *CreateEnvironmentMembershipInput) SetPermissions(v string) *CreateEnvironmentMembershipInput {
	s.Permissions = &v
	return s
}
985320
func (s *EnvironmentMember) SetPermissions(v string) *EnvironmentMember {
	s.Permissions = &v
	return s
}
1066660
func (n *NewTeam) GetPermission() string {
	if n == nil || n.Permission == nil {
		return ""
	}
	return *n.Permission
}
805754
func NewPermissions(state *UserState) *Permissions {
	// default permissions
	return &Permissions{state,
		[]string{"/admin"},         // admin path prefixes
		[]string{"/repo", "/data"}, // user path prefixes
		[]string{"/", "/login", "/register", "/favicon.ico", "/style", "/img", "/js",
			"/favicon.ico", "/robots.txt", "/sitemap_index.xml"}, // public
		true,
		PermissionDenied}
}
412643
func (t *Team) GetPermission() string {
	if t == nil || t.Permission == nil {
		return ""
	}
	return *t.Permission
}
244389
func VerifyPermissions(ctx context.Context, ps []influxdb.Permission) error {
	for _, p := range ps {
		if err := IsAllowed(ctx, p); err != nil {
			return &influxdb.Error{
				Err:  err,
				Msg:  fmt.Sprintf("permission %s is not allowed", p),
				Code: influxdb.EForbidden,
			}
		}
	}

	return nil
}
955345
func (o *Ownership) GetGroups() map[string]Ownership_AccessType {
	if o.GetAcls() == nil {
		return nil
	}
	return o.GetAcls().GetGroups()
}